package com.thread;

public class TestDeadThread {

	static String a = "a";

	static String b = "b";

	public static void main(String args[]) {
		new Thread("threadA") {
			@Override
			public void run() {
				synchronized (b) {
					try {
						Thread.sleep(2000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					synchronized (a) {
						System.out.print("do some thing a");
					}


				}
			}
		}.start();


		new Thread("threadB") {
			@Override
			public void run() {
				synchronized (a) {
					try {
						Thread.sleep(2000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					synchronized (b) {
						System.out.print("do some thing b");
					}

				}

			}
		}.start();
	}

}
